import sys

result = {}

for data in sys.stdin:
    data = data.strip()
    if data in result:
        result[data] = result[data] + 1
    else:
        result[data] = 1

for key, value in result.items():
	sys.stdout.write("%s\t%s\n" % (key, str(value)))